package com.bmw.seed.controller;

import com.bmw.seed.service.ROrderService;
import com.bmw.seed.service.RankService;
import com.bmw.seed.util.bean.BaseResponse;
import com.bmw.seed.util.bean.OrderReq;
import com.bmw.seed.util.bean.RankResp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
 * Classname: RankController
 * Package: com.bmw.seed.controller
 * Description:
 *
 * @Author 王少伟
 * @Create 2024/1/31 10:43
 * @Version 1.8
 */
@RestController
@RequestMapping(value = "/rank")
public class RankController {
    @Autowired
    RankService rankService;

    @Autowired
    ROrderService rOrderService;


    /**
     * 实时排行榜
     */
    @RequestMapping(value = "/list")
    public BaseResponse<List<RankResp>> list3(){
        return BaseResponse.OK(rankService.list3());
    }
    /**
     * 下单接口
     */
    @RequestMapping(value = "/order")
    public BaseResponse order(@RequestBody @Valid OrderReq orderReq){
        return BaseResponse.ok(rOrderService.order(orderReq));
    }

}
